package com.huaguoguo.cyg.webmagic;

import lombok.Data;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.model.ConsolePageModelPipeline;
import us.codecraft.webmagic.model.OOSpider;
import us.codecraft.webmagic.model.annotation.ExtractBy;
import us.codecraft.webmagic.model.annotation.TargetUrl;
import us.codecraft.webmagic.pipeline.JsonFilePageModelPipeline;

import java.util.List;

/**
 * 类说明： <br/>
 * author:huaguoguo
 * Date: 2019/8/14
 * Time: 23:45
 */
@Data
@TargetUrl("http://tl.cyg.changyou.com/")
public class OschinaBlog {

    @ExtractBy("title/text()")
    private String title;

//    @ExtractBy(value = "div.BlogContent",type = ExtractBy.Type.Css)
//    private String content;
//
//    @ExtractBy(value = "//div[@class='BlogTags']/a/text()", multi = true)
//    private List<String> tags;
    @ExtractBy(value = "script")
    private List<String> scripts;

    public static void main(String[] args) {
        OOSpider.create(
                Site.me(),
                new MyPipeline(), OschinaBlog.class).addUrl("http://tl.cyg.changyou.com/").run();
    }
}
